using System;
using System.Web.Mail;

using Actions;
using Actions.Security;
using Actions.Connectors;
using Actions.Databases;

namespace Actions.Usecases
{
	/// <summary>
	/// Description of BaseUsecase.
	/// </summary>
	public class BaseUsecase : IUsecase
	{
		protected Document			_d;
		
		public BaseUsecase()
		{
			_d = new Document();
		}
		
		public virtual void execute(ref IConnector c, SecurityAgent sa)
		{	
			_d.DocumentElement.InnerXml += sa.currentUser.userInfo;

			sa.log(ref c);			
			process(ref c, sa);
			c.sendDocument(_d);
		}
		
		protected virtual void process(ref IConnector c, SecurityAgent sa)
		{}
		
		protected void goToLink(string name)
		{
			_d.DocumentElement.InnerXml += "<relocate>" + name + "</relocate>";
		}		
	}
}
